home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / pascal / DELPHI.SWG / 0002_Ragged Paint Blotter like SK Windows.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-02-21  |  6.5 KB  |  325 lines

  1. unit Blotter2;
  2.  
  3. interface
  4.  
  5. uses
  6.     SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.     Forms, Dialogs, ExtCtrls;
  8.  
  9. type
  10.     TmeiBlotter = class(TPanel)
  11.  
  12.     private
  13.         { Private declarations }
  14.  
  15.     protected
  16.         { Protected declarations }
  17.         procedure Paint; override;
  18.  
  19.     public
  20.         { Public declarations }
  21.         constructor Create(AOwner: TComponent); override;
  22.  
  23.     published
  24.       { Published declarations }
  25.  
  26.  end;
  27.  
  28. procedure Register;
  29.  
  30. implementation
  31.  
  32. {
  33. 1. A way to get the component to know what events should
  34. trigger it
  35. 2. A way to get it to paint at design time
  36. 3. A color property
  37. 4. A way to publish the PaintBlotter method.
  38. }
  39.  
  40. constructor TmeiBlotter.Create(AOwner: TComponent);
  41.     Begin
  42.     Inherited Create(Aowner);
  43.     if (csDesigning in ComponentState) then
  44.     begin
  45.         BorderWidth := 8;
  46.         Color := clGreen;
  47.         Align := alClient;
  48.     end;
  49.     End;
  50.  
  51. procedure TmeiBlotter.Paint;
  52. Begin
  53.  
  54. With Canvas Do
  55.     Begin
  56.  
  57.     Brush.Color := Color; {BlotterColor;}
  58.     Rectangle(0,0,Width,Height);
  59.  
  60. {**************************************************}
  61.     {draw vertical lines on left side of form}
  62.     Pen.Color := clBlack;
  63.     Moveto(0,0);                {column,row}
  64.     Lineto(0,Height);
  65.  
  66.     Pen.Color := clSilver;
  67.     Moveto(0+1,0);                {column,row}
  68.     Lineto(0+1,Height);
  69.  
  70.     Pen.Color := clBlack;
  71.     Moveto(0+4,0);                {column,row}
  72.     Lineto(0+4,Height);
  73.  
  74.     {draw vertical line on right side of form}
  75.     Pen.Color := clSilver;
  76.     Moveto(Width-4,0);
  77.     Lineto(Width-4,Height);
  78.  
  79.     Pen.Color := clBlack;
  80.     Moveto(Width-1,0);
  81.     Lineto(Width-1,Height);
  82.  
  83.     {draw horizontal line on top side of form}
  84.     Pen.Color := clBlack;
  85.     Moveto(0,0);
  86.     Lineto(Width,0);
  87.  
  88.     Pen.Color := clSilver;
  89.     Moveto(0,0+1);
  90.     Lineto(Width,0+1);
  91.  
  92.     Pen.Color := clBlack;
  93.     Moveto(0,0+4);
  94.     Lineto(Width,0+4);
  95.  
  96.     {draw horizontal line on bottom side of form}
  97.     Pen.Color := clSilver;
  98.     Moveto(0,Height-4);
  99.     Lineto(Width,Height-4);
  100.  
  101.     Pen.Color := clBlack;
  102.     Moveto(0,Height-1);
  103.     Lineto(Width,Height-1);
  104.  
  105.     {***************************************************}
  106.     {draw blotter outer corners}
  107.     Pen.Color := clYellow;
  108.     {Upper Left vertical and horizontal}
  109.     MoveTo(0+1,0+1);
  110.     LineTo(0+1,15);
  111.     Moveto(0+1,0+1);
  112.     LineTo(15,0+1);
  113.     {Lower Left vertical only }
  114.     MoveTo(0+1,Height-1);
  115.     LineTo(0+1,Height-16);
  116.     {Lower Right}
  117.   Pen.Color := clBlack;
  118.     MoveTo(Width-2,Height-1);
  119.     LineTo(Width-15,Height-1);
  120.     MoveTo(Width-1,Height-1);
  121.     LineTo(Width-1,Height-15);
  122.     Pen.Color := clYellow;
  123.     MoveTo(Width-15,Height-1);
  124.     LineTo(Width-16,Height-1);
  125.     MoveTo(Width-1,Height-15);
  126.     LineTo(Width-1,Height-16);
  127.     {Upper Right, horizontal only}
  128.     MoveTo(Width-15, 1);
  129.   LineTo(Width-1, 1);
  130.  
  131. {************************************************}
  132.     {draw blotter inner corners}
  133.     Pen.Color := clBlack;
  134.     Brush.Color := clBlack;
  135.     {Upper Left}
  136.     MoveTo(0+5,0+5);
  137.     LineTo(0+5,6+6);
  138.     Moveto(0+5,0+5);
  139.     LineTo(6+6,0+5);
  140.  
  141.     {Lower Left}
  142.     MoveTo(0+5,Height-5);
  143.     LineTo(0+5,(Height-5)-7);    {draw vert}
  144.     Moveto(0+5,Height-5);
  145.     LineTo(12,Height-5);    {draw horiz}
  146.  
  147.     Pen.Color := clYellow;
  148.     MoveTo(0+6,Height-5);
  149.     LineTo(11,Height-5);
  150.     Pen.Color := clBlack;
  151.  
  152.         {lower right}
  153.     Pen.Color := clYellow;
  154.     MoveTo(Width-5,Height-5);
  155.     LineTo(Width-5,Height-12);
  156.     MoveTo(Width-5,Height-5);
  157.     LineTo(Width-12,Height-5);
  158.  
  159.     {Upper Right}
  160.   Pen.Color := clBlack;
  161.     MoveTo(Width-11,5);
  162.     LineTo(Width-5,5);
  163.     Pen.Color := clYellow;
  164.     MoveTo(Width-5,5);
  165.   LineTo(Width-5,13);
  166.  
  167. {************************************************}
  168.     {draw the staircase pixels}
  169.     Pen.Color := clBlack;
  170.  
  171.     {upper left}
  172.             {lower pixels}
  173.     MoveTo(0+1,15);
  174.     LineTo(0+4,12);
  175.  
  176.     Moveto(2,Height-13);
  177.     LineTo(3,Height-12);
  178.     Moveto(4,Height-11);
  179.     LineTo(4,Height-11);
  180.  
  181.             {upper pixels}
  182.     MoveTo(15,0+1);
  183.     LineTo(12,0+4);
  184.  
  185.  
  186.     {lower left}
  187.             {upper pixels}
  188.     Pen.Color := clYellow;
  189.     Moveto(2,Height-14);
  190.     LineTo(5,Height-11);
  191.  
  192.     Pen.Color := clBlack;
  193.     MoveTo(11,Height-5);
  194.     LineTo(15,Height-1);
  195.  
  196.     {lower right}
  197.     Pen.Color := clYellow;
  198.     MoveTo(Width-15,Height-1);
  199.     LineTo(Width-10,Height-6);
  200.     MoveTo(Width-1,Height-15);
  201.     LineTo(Width-6,Height-10);
  202.  
  203.     { Upper Right}
  204.   Pen.Color := clBlack;
  205.     MoveTo(Width-1,16);
  206.     LineTo(Width-5,12);
  207.  
  208.     MoveTo(Width-14,2);
  209.     LineTo(Width-12,4);
  210.  
  211. {****************************************************}
  212.     {fill in "brass" areas for corners}
  213.     Brush.Color := clOlive;
  214.     Pen.Color := clOlive;
  215.  
  216.     {upper left}
  217.     {fill in large areas}
  218.     Rectangle(2,2,5,12);
  219.     Rectangle(2,2,12,5);
  220.  
  221.     {fill in upper pixels}
  222.     Moveto(12,2);
  223.     LineTo(14,2);
  224.     Moveto(12,3);
  225.     LineTo(13,3);
  226.     {fill in lower pixels}
  227.     MoveTo(2,12);
  228.     LineTo(2,14);
  229.     MoveTo(3,12);
  230.     LineTo(3,13);
  231.  
  232. {------------------------}
  233.     {lower left}
  234.     {fill in large areas}
  235.     Rectangle(2,Height-1,12,Height-4);
  236.     Rectangle(2,Height-2,5,Height-11);
  237.  
  238.     {fill in upper pixels}
  239.     Moveto(2,Height-13);
  240.     LineTo(3,Height-12);
  241.     Moveto(2,Height-12);
  242.     LineTo(4,Height-12);
  243.     Moveto(4,Height-11);
  244.     LineTo(4,Height-11);
  245.     {fill in lower pixels}
  246.     MoveTo(12,Height-3);
  247.     LineTo(13,Height-2);
  248.     MoveTo(14,Height-1);
  249.     LineTo(14,Height-1);
  250.     MoveTo(12,Height-2);
  251.     LineTo(14,Height-2);
  252.  
  253.   {-----------------------}
  254.         {lower right}
  255.  
  256.         {fill in large areas}
  257.     Rectangle(Width-1,Height-1,Width-11,
  258.                                                                                     Height-4);
  259.     Rectangle(Width-1,Height-1,Width-4,Height-11);
  260.  
  261.     {fill in upper pixels}
  262.     MoveTo(Width-3,Height-12);
  263.     LineTo(Width-1,Height-12);
  264.     MoveTo(Width-2,Height-13);
  265.     LineTo(Width-1,Height-13);
  266.  
  267.     {fill in lower pixels}
  268.     MoveTo(Width-12,Height-3);
  269.     LineTo(Width-12,Height-1);
  270.     MoveTo(Width-13,Height-2);
  271.     LineTo(Width-13,Height-1);
  272.  
  273.     {-----------------------}
  274.         {upper right}
  275.  
  276.         {fill in large areas}
  277.     Rectangle(Width-11,2,Width-1,5);
  278.     Rectangle(Width-1,13,Width-4,2);
  279.  
  280.         {fill in upper pixels}
  281.         MoveTo(Width-12,2);
  282.         LineTo(Width-12,4);
  283.         MoveTo(Width-13,2);
  284.     LineTo(Width-13,1);
  285.  
  286.         {fill in lower pixels}
  287.         MoveTo(Width-2,13);
  288.         LineTo(Width-4,13);
  289.         MoveTo(Width-2,14);
  290.         LineTo(Width-1,14);
  291.  
  292. {***************************************************}
  293.     {cleanup corner pixels}
  294.     Pen.Color := clBlack;
  295.     Moveto(0,0);
  296.     LineTo(0,10);
  297.  
  298.     {Lower Left}
  299.     MoveTo(0,Height-1);
  300.     LineTo(13,Height-1);
  301.     MoveTo(0,Height-1);
  302.     LineTo(0,Height-14);
  303.  
  304.         {Upper Right}
  305.     Moveto(Width-1,0);
  306.     LineTo(Width-14,0);
  307.     Moveto(Width-1,0);
  308.     LineTo(Width-1,13);
  309.  
  310.     {Lower Right}
  311.     MoveTo(Width-1,Height-1);
  312.     LineTo(Width-14,Height-1);
  313.     MoveTo(Width-1,Height-1);
  314.     LineTo(Width-1,Height-14);
  315.  
  316.    end;
  317. end;
  318.  
  319. procedure Register;
  320. begin
  321.     RegisterComponents('PRIME', [TmeiBlotter]);
  322. end;
  323.  
  324. end.
  325.